local yingzun = fk.CreateSkill {
  name = "reminiscence__yingzun",
}

local yingzun_mark = "@reminiscence__yingzun-phase"

Fk:loadTranslationTable{
  ["reminiscence__yingzun"] = "盈尊",
  [":reminiscence__yingzun"] = "出牌阶段限一次，你可以摸X张牌（X为此技能发动次数）。"
  .."然后若你的手牌数大于你的体力上限，你减1点体力上限，于本阶段可以多使用一张【杀】。",
  ["reminiscence__yingzun-prompt"] = "盈尊：可以摸 %arg 张牌，然后若手牌数大于体力上限，减体力上限，本阶段可以多使用【杀】",

  ["$reminiscence__yingzun1"] = "号令天下，莫敢不从！",
  ["$reminiscence__yingzun2"] = "势倾四海，声震天下！",
}

yingzun:addEffect("active", {
  anim_type = "drawcard",
  prompt = function (self, player, selected_cards, selected_targets)
    local n = player:usedSkillTimes(yingzun.name, Player.HistoryGame) + 1
    return "reminiscence__yingzun-prompt:::"..n
  end,
  card_num = 0,
  target_num = 0,
  can_use = function (self, player)
    return player:usedSkillTimes(yingzun.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local n = effect.from:usedSkillTimes(yingzun.name, Player.HistoryGame)
    effect.from:drawCards(n, yingzun.name)
    if effect.from.dead then return end
    if effect.from:getHandcardNum() > effect.from.maxHp then
      room:changeMaxHp(effect.from, -1)
      room:addPlayerMark(effect.from, yingzun_mark)
    end
  end,
})

yingzun:addEffect("targetmod", {
  residue_func = function(self, player, skill, scope)
    if skill.trueName == "slash_skill" and scope == Player.HistoryPhase
    and player.phase == Player.Play then
      return player:getMark(yingzun_mark)
    end
  end,
})

return yingzun